package com.tsd.job.service;

import com.tsd.core.vo.HlpException;
import com.tsd.core.vo.PageBean;
import com.tsd.job.entity.SysTaskJob;
import com.tsd.job.entity.SysTaskJobExt;
import com.tsd.system.entity.SysUser;
import com.tsd.system.entity.SysUserExt;
import org.quartz.SchedulerException;

import java.util.List;
import java.util.Map;

/**
 * 描述：SysTaskJob服务实现层接口
 *
 * @author huawei
 * @date 2022/02/20 16:29:26
 */
public interface SysTaskJobService {

    /**
     * 描述：根据id获取SysTaskJob
     *
     * @param id
     */
    SysTaskJob getSysTaskJobById(Long id) throws Exception;

    /**
     * 描述：根据sid获取SysTaskJob
     *
     * @param sid
     */
    SysTaskJobExt queryBySid(String sid) throws Exception;

    /**
     * 描述：根据sid列表删除SysTaskJob
     *
     * @param list
     */
    void deleteSysTaskJobs(List<String> list, SysUser opUser) throws Exception;

    /**
     * 描述：保存或更新SysTaskJob
     *
     * @param record
     * @param opUser
     */
    void saveSysTaskJob(SysTaskJobExt record, SysUser opUser) throws Exception;

    /**
     * 描述：根据params分页查询SysTaskJob
     *
     * @param params
     * @param page
     */
    List<SysTaskJobExt> findSysTaskJobs(Map<String, Object> params, PageBean page) throws Exception;

    /**
     * 描述：根据params分页查询SysTaskJob
     *
     * @param params
     */
    List<SysTaskJobExt> findSysTaskJobs(Map<String, Object> params) throws Exception;

    List<SysTaskJobExt> queryByEntity(SysTaskJobExt params);

    /**
     * 更新quartz
     *
     * @param job
     * @throws SchedulerException
     * @throws ClassNotFoundException
     */
    void updateQuartzFactory(SysTaskJobExt job) throws SchedulerException, ClassNotFoundException, HlpException;

    /**
     * 更新quartz（Spring）
     *
     * @param jobExt
     * @throws Exception
     */
    void updateQuartzFactory4Spring(SysTaskJobExt jobExt) throws Exception;

    List<SysTaskJobExt> findAllEnable() throws Exception;

    List<Object> getJobObjectAndMethodList();

    void startQuartz(List<String> list, SysUserExt opUser) throws Exception;

    void stopQuartz(List<String> list, SysUserExt opUser) throws Exception;
}
